home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Programmer Disk
/
The Programmer Disk (Microforum).iso
/
xpro
/
vb1
/
pro4
/
bmpkit.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1991-10-05
|
8KB
|
180 lines
Form1
Form1
Form1
Picture1
Label1
Scaled Image
Command1
VScroll1
Option1
Picture2
Option2
HScroll1
Label2
Label3
Command2
Display
Command3
Print
Command5
Hide Original
Command4
Show Original
Form_Click
@ Form_Loadx
Picture2
scalemode
width
height
hscroll1S
hscroll
smallchange
largechange<
values
vscroll1
picture1
visible
PictureZ
scalex)
scaleyA
command2_click
Command1_Click
picture3
moveflag
scaleflag
defaultmargin
leftY
SRCCOPY
NEWFRAME/
pixel
graphicfile
printer
printgraphicx
littlex
printgraphicy
littleyI
scalewidth
scaleheight
hMemoryDCe
CreateCompatibleDC
hOldBitMap
SelectObject
ApiError
StretchBlt
DeleteDC
constants
calls6
Command3_Click
requires
coordinates
graphic
match
current
inchk
positionsR
invisible
form1
certain
factors
Command4_Click
Command5_ClickW
HScroll1_Change
option2?
option1
Check1_Click3
check1
xyproportion
VScroll1_ChangeK
above
selected
positive
currentx
currenty
drawwidth
Form_Load
*set form and picture ScaleModes
set the Move optionn
set initial picture width
*Setup scroll bar values
*Set Horizontal Scrollbar to center
*Set Vertical Scrollbar to centere
*Make Picture1 box invisible...This picture box, which
holds the basic image, does not have to show. Note that
we'll use the printer resolution of this box for sizing.
For example, a 300X300 pixel image will print as 1X1 inchh
on a laser printer..
*Load bitmap into Picture1 ... put PAPER.BMP, a Windowss
background image in the VB directory, or in the defaultt
directory, or change the filespec to match it's location.
Choose your own, or let user load.
RIBBONS.BMP"
*Set scaling factors to 1 for full-size image.
To reduce or enlarge the original when first displayed,
change these figures.t
*Display Picture in Picture2
Command1_Click
command2_click
Make sure we have valid scaling values
Set picture2.width to match picture1, with scaling.V
The 3.14 divisor matches inch dimension with the
640X480 screen dimensions. Change for other displayy
adapters..
*Set constants for GDI calls
*Display scaled version in Picture2a
*StretchBlt requires pixel coordinates..
Set Dimensions for Picture2c
*Do not change the order of these statements.
Variables for the StretchBlt function:
1. Source of image HMemeoryDC% -- set above from original picturee
2,3. Positioning on output object. Must be integer, in pixels.
4,5. Width, height of output image. Here we use the values set above.r
6, Source of image...in this case the memory image set by CreateCompatibleDC% function
7,8. Don't know. Set to 0 works just fine! Experiment and let me know.
9,10. X/Y coordinates for how much of original to put in new object. You can use
these values for cropping, if you like..
11. SRCCOPY, as set in constants above. Change at own risk..
*Reset scalemodes to previous inch valuess
Command3_Click
* Print all items other than the image first..
Hello
*After printing all other elements include your BMPP
printing routine, as below.l
* Print Scaled Image
*Make certain we have valid scaling values
*Set GDI Constants
* StretchBlt requires pixel coordinates.
*First two variables are the x,y coordinates (in Pixels)
for the placement of images on the printed page. Since the
form's ScaleMode is 5 for inches, multiply by 300 to
match the the current inch positions of Picture2 onn
the 300 DPI device.n
*Second pair of variables set the height and width of thee
graphic to match the pixel size of the original picturee
in the invisible Picture1 box.
*Do not change the order of these statements.a
Variables for the StretchBlt function:
1. Source of image HMemeoryDC% -- set above from original picturec
2,3. Positioning on output object. Must be integer, in pixels.
4,5. Width, height of output image. Here we use the values set above.Y
6, Source of image...in this case the memory image set by CreateCompatibleDC% function
7,8. Don't know. Set to 0 works just fine! Experiment and let me know.
9,10. X/Y coordinates for how much of original to put in new object. You can use
these values for cropping, if you like.r
11. SRCCOPY, as set in constants above. Change at own risk.w
*Send image and text to printers
Command4_Click
Command5_Click
HScroll1_Change
*If the Move option is selected (default) then add the positive or
negative Value of Hscroll1 to the top left of the picture,
redraw. Notice that the multiplier is .01 to deal with the
inch settings. Scroll Values must be integers., so we cane
move in .01 inch increments.
If the Size option is selected, then add the positive or
negative Value of Hscroll1 to the scalex variable, thenn
redraw. Notice that the multiplier is .01 to deal with the
inch settings. Scroll Values must be integers., so we cann
move in .01 inch increments.
VScroll1_Change
*See Hscroll1_Change for explanations.